
abstract class Stones 
{
    public abstract double Price { get; set; }
    public abstract double Weight { get; set; }
    public abstract string Name { get; set; }
}

class Precious : Stones
{
    public string Color;
    public double Hardness;
    public double Electricity;
    public double Transparency;
      
    public double _price;  
    public double _weight;  
    public string _name;
  
    public override string Name  
    {  
        get { return _name; }  
        set { _name = value; }  
    }  
 
    public override double Price  
    {  
        get { return _price; }  
        set {   _price = value; }  
    }

    public override double Weight  
    {
        get { return _weight; }
        set { _weight = value; }  
    } 
}

class Semiprecious : Stones
{
    public double Content_of_synthetic;
    public int Count_of_fracture;

    public double _price;
    public double _weight;
    public string _name;  
  
    public override string Name  
    {  
        get { return _name; }  
        set { _name = value; }  
    }  
 
    public override double Price  
    {  
        get { return _price; }  
        set {   _price = value; }  
    }

    public override double Weight  
    {
        get { return _weight; }
        set { _weight = value; }  
    }
}

class Corundum  : Precious
{
	public Corundum() : this(null){ }  
    public Corundum(string _name): this(_name, 0){ }  
    public Corundum(string _name, double _price)
        : this(_name, _price, 0) { }
    public Corundum(string _name, double _price, double _weight)  
    {  
        this._name = _name;  
        this._price = _price;
        this._weight = _weight;  
    }
    public Corundum(string _name, double _price, double _weight, string Color, double Hardness, double Electricity, double Transparency)
    {
        this._name = _name;
        this._price = _price;
        this._weight = _weight;
        this.Color = Color;
        this.Hardness = Hardness;
        this.Electricity = Electricity;
        this.Transparency = Transparency;
    }
}

class Beryl  : Precious
{
	public Beryl() : this(null){ }  
    public Beryl(string _name): this(_name, 0){ }  
    public Beryl(string _name, double _price)
        : this(_name, _price, 0) { }
    public Beryl(string _name, double _price, double _weight)  
    {  
        this._name = _name;  
        this._price = _price;
        this._weight = _weight;  
    }
    public Beryl(string _name, double _price, double _weight, string Color, double Hardness, double Electricity, double Transparency)
    {
        this._name = _name;
        this._price = _price;
        this._weight = _weight;
        this.Color = Color;
        this.Hardness = Hardness;
        this.Electricity = Electricity;
        this.Transparency = Transparency;
    }
}

class Gem : Semiprecious
{
    public Gem () : this(null){ }  
    public Gem (string _name): this(_name, 0){ }  
    public Gem (string _name, double _price)
        : this(_name, _price, 0) { }
    public Gem (string _name, double _price, double _weight)  
    {  
        this._name = _name;  
        this._price = _price;
        this._weight = _weight;  
    }
    public Gem(string _name, double _price, double _weight, double Content_of_synthetic, int Count_of_fracture)
    {
        this._name = _name;
        this._price = _price;
        this._weight = _weight;
        this.Content_of_synthetic = Content_of_synthetic;
        this.Count_of_fracture = Count_of_fracture;
    }
}

abstract class PreciousCreator
{
    public abstract Precious FactoryMethod();
    public abstract Precious FactoryMethod(string _name);
    public abstract Precious FactoryMethod(string _name,
        double _price);
    public abstract Precious FactoryMethod(string _name,
        double _price, double _weight);
    public abstract Precious FactoryMethod(string _name, double _price, double _weight, string Color, double Hardness, double Electricity, double Transparency);
}

abstract class SemipreciousCreator
{
    public abstract Semiprecious FactoryMethod();
    public abstract Semiprecious FactoryMethod(string _name);
    public abstract Semiprecious FactoryMethod(string _name,
        double _price);
    public abstract Semiprecious FactoryMethod(string _name,
        double _price, double _weight);
    public abstract Semiprecious FactoryMethod(string _name, double _price, double _weight, double Content_of_synthetic, int Count_of_fracture);
}

class CorundumCreator : PreciousCreator
{
    public override Precious FactoryMethod()
    {
        return new Corundum();
    }

    public override Precious FactoryMethod(string _name)
    {
        return new Corundum(_name);
    }

    public override Precious FactoryMethod(string _name,
        double _price)
    {
        return new Corundum(_name, _price);
    }

    public override Precious FactoryMethod(string _name,
        double _price, double _weight)
    {
        return new Corundum(_name, _price, _weight);
    }
    public override Precious FactoryMethod(string _name, double _price, double _weight, string Color, double Hardness, double Electricity, double Transparency)
    {
        return new Corundum(_name, _price, _weight, Color, Hardness, Electricity, Transparency);
    }
}

class BerylCreator : PreciousCreator
{
    public override Precious FactoryMethod()
    {
        return new Beryl();
    }

    public override Precious FactoryMethod(string _name)
    {
        return new Beryl(_name);
    }

    public override Precious FactoryMethod(string _name,
        double _price)
    {
        return new Beryl(_name, _price);
    }

    public override Precious FactoryMethod(string _name,
        double _price, double _weight)
    {
        return new Beryl(_name, _price, _weight);
    }
    public override Precious FactoryMethod(string _name, double _price, double _weight, string Color, double Hardness, double Electricity, double Transparency)
    {
        return new Beryl(_name, _price, _weight, Color, Hardness, Electricity, Transparency);
    }
}

class GemCreator : SemipreciousCreator
{
    public override Semiprecious FactoryMethod()
    {
        return new Gem();
    }

    public override Semiprecious FactoryMethod(string _name)
    {
        return new Gem(_name);
    }

    public override Semiprecious FactoryMethod(string _name,
        double _price)
    {
        return new Gem(_name, _price);
    }

    public override Semiprecious FactoryMethod(string _name,
        double _price, double _weight)
    {
        return new Gem(_name, _price, _weight);
    }

    public override Semiprecious FactoryMethod(string _name, double _price, double _weight, double Content_of_synthetic, int Count_of_fracture)
    {
        return new Gem(_name, _price, _weight, Content_of_synthetic, Count_of_fracture);
    }
}

class Necklace  
{
    public string Name;
    public double weight;
    public double cost;
    public Precious Main_stone;
    public Precious SecondMain_stone;
    public Semiprecious Minor_Stone;
	public void Sum_Cost(int price)
    {
        cost += price;
	}

    public void Sum_Weight(int price)
    {
        weight -= price;
    }

    public double get_Cost()
    {
        return cost;
    }

    public double get_Weight()
    {
        return weight;
    }
}

